﻿using System;
using System.Runtime.Serialization;

namespace Guru.ErrorHandling
{
    public class GuruException : Exception
    {
        private LogEntry _logEntry;

        public GuruException(Exception exc, LogEntry log)
        {
            _logEntry = log;
            if (exc != null)
            {
                _logEntry.StackTrace = exc.StackTrace;
                _logEntry.Message = exc.Message;
            }
            _logEntry.Write();
        }


        public GuruException()
        {
        }

        public GuruException(string message)
            : base(message)
        {
        }

        public GuruException(string message, Exception inner)
            : base(message, inner)
        {
        }

        protected GuruException(
          SerializationInfo info,
          StreamingContext context)
            : base(info, context)
        {
        }



    }
}
